<?php
//header("Content-Type:text/json");
$sever = '127.0.0.1';
$username = 'root';
$passwords = '';
$databaseName = 'userdate';
$con = new mysqli($sever, $username, $passwords, $databaseName);
$phonenumber = $_GET['phonenumber'];
$password = $_GET['password'];
if ($con -> connect_error) {
	echo("数据库链接失败" . $con -> connect_error);
}
//$userdate = 'create userdate if not exists userdate (id int not null auto_increment,phonenumber int(255),password varchar(255),primary key(id))';
//if (!$con -> query($userdate)) {
//	echo '表创建失败';
//} else {
//	echo '表创建成功';
//}
$userdate = 'select * from userdate where (phonenumber = "'.$phonenumber.'") and (password = "'.$password.'")';
$resultArr = $con -> query($userdate);
if ($resultArr -> num_rows > 0) {
	echo '手机号已经被占用';
} else {
	$createli = 'insert into userdate(phonenumber,password) values("'.$phonenumber.'","'.$password.'")';
	if ($con -> query($createli)) {
		echo "注册成功";
	} else {
		echo '注册失败';
	}
}
?>